package testing;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import bot.City;
import bot.DataStorage;
import bot.FileStorage;

public class RepeatDataTest {
	public static void main(String[] args){
		List<City> cities = new ArrayList<City>();
		File file = new File("c:\\Users\\Jamison\\Documents\\PopulationInfo\\WisconsinData.txt");
		DataStorage data = new FileStorage(file);
		BufferedReader reader;
		try{
			reader = new BufferedReader(new FileReader(file));
			String line = null;
			List<String> lines = new ArrayList<String>();
			while ((line = reader.readLine()) != null){
				if (!line.equals("")){
					lines.add(line);
				}
			}
			for (String str: lines){
				String temp[] = str.split(" ;&: ");
				String url = temp[0];
				String areaLand = data.getAreaLand(url);
				String population = data.getTotalPopulation(url);
				for (String test: lines){
					String temp2[] = test.split(" ;&: ");
					String url2 = temp2[0];
					if (!url2.equals(url)){
						boolean one = areaLand.equals(data.getAreaLand(url2));
						boolean two = population.equals(data.getTotalPopulation(url2));
						if (data.getName(url2).equals(data.getName(url)) && (one || two)){
							System.out.println(one + " " + two);
							System.out.println("Testing url = " + url);
							System.out.println("Similar data = " + url2);
						}
					}
				}
			}
		} 
		catch (FileNotFoundException e){
			e.printStackTrace();
		}
		catch (IOException e){
			e.printStackTrace();
		}

	}
}
